home *** CD-ROM | disk | FTP | other *** search
- Path: news.uoregon.edu!xmission!news
- From: tknarr@xmission.com ( Todd Knarr )
- Newsgroups: comp.lang.c++
- Subject: Re: Quick and Dirty Date Function
- Date: 17 Jan 1996 02:32:22 GMT
- Organization: Chaos Central
- Message-ID: <4dhn3m$i57@news.xmission.com>
- References: <4dfatq$fec@news.pacifier.com>
- Reply-To: tknarr@xmission.com ( Todd Knarr )
- NNTP-Posting-Host: slc138.xmission.com
- X-Newsreader: IBM NewsReader/2 v1.2
-
- In <4dfatq$fec@news.pacifier.com>, dgager@pacifier.com (Dave Gager) writes:
- > Does anybody know of, or have, a quick & dirty function that takes two
- >dates and returns the EXACT number of days between them (inclusive).
- >Preferrably, it should not need any maintenence after the year 2000,
-
- I don't know about quick-and-dirty, but I did come up with a class
- based on some routines for converting year/month/day to Julian day
- numbers. Once you've got Julian day numbers, the difference between
- them gives you the number of days between the two dates. I've checked
- them for sanity ( round-tripped every date and checked that the Julian
- day number for each date is one more than the Julian day number for
- the previous date ) over the range 1-Jan-4713BC through 31-Dec-9999AD.
-
- The routines I used were courtesy of Eric Bergman-Terrell and appeared
- in the December 1990 issue of Computer Language. I can e-mail the class
- to you if you're interested, or post the class for dissection here ( the
- results will no doubt be messy <g> ).
-
- --
- Todd Knarr : tknarr@xmission.com | finger for PGP public key
- | Member, USENET Cabal
-
- Seriously, I don't want to die just yet. I don't care how
- good-looking they are, I! don't! want! to! die!"
- -- Megazone ( UF1 )
-
-